<!-- 搜索框 -->
<template>
  <div class="component-container h-search-for-container">
    <div
      class="search-for-out-wrap"
      :style="{
        backgroundColor: tempData.bgColor,
      }"
    >
      <!-- 搜索 -->
      <div class="search-content-wrap">
        <!-- 左 -->
        <!-- <div class="search-left-wrap" v-if="tempData.type != 0">
          左侧区域自定义
        </div> -->
        <div class="content-search-wrap">
          <div
            class="search-input-wrap"
            :style="{
              background: tempData.boxBgColor,
              borderRadius: tempData.radiusNum + 'px',
            }"
          >
            <div class="input-el-wrap">这是输入框</div>
            <p class="search-btn-wrap" v-if="tempData.searchBtn">搜索</p>
          </div>
        </div>
        <!-- <div class="right-search-wrap" v-if="tempData.type == 2">
          右侧区域自定义
        </div> -->
      </div>
    </div>
  </div>
</template>

<script setup name="SearchFor">
  import { ref, watch } from 'vue'

  const props = defineProps({
    // 选中的当前组件参数
    compObj: {
      type: Object,
      default: () => {
        return {}
      },
    },
  })
  console.log(props)
  const tempData = ref({})
  watch(
    () => props.compObj,
    (newVal, oldVal) => {
      tempData.value = JSON.parse(JSON.stringify(newVal))
    },
    { immediate: true, deep: true }
  )
</script>
<style lang="less">
  .component-container.h-search-for-container {
    width: 100%;
    .search-for-out-wrap {
      width: 100%;
      background-repeat: no-repeat;
      background-position: top center;
      background-size: 100% 100%;
    }
    .search-content-wrap {
      display: flex;
      justify-content: center;
      align-items: center;
      .search-left-wrap,
      .right-search-wrap {
        width: 60px;
        height: 34px;
        font-size: 12px;
        line-height: 34px;
        text-align: center;
        // background-color: #eeeeee;
      }
      .content-search-wrap {
        flex: 1;
        height: 34px;
      }

      .search-input-wrap {
        width: 100%;
        height: 34px;
        display: flex;
        justify-content: center;
        align-items: center;
        border: 1px solid rgba(0, 0, 0, 0.2);
        padding-left: 10px;
        box-sizing: border-box;
        position: relative;
        .input-el-wrap {
          flex: 1;
          // height: 100%;
          // line-height: 34px;
          padding-left: 4px;
          box-sizing: border-box;
          color: #b8b8b8;
          font-size: 14px;
        }
        .search-btn-wrap {
          height: 100%;
          background-color: #00a9ac;
          font-size: 16px;
          color: #ffffff;
          width: 62px;
          text-align: center;
          line-height: 34px;
          border-radius: 17px;
          position: absolute;
          right: 0;
          top: 0;
          bottom: 0;
        }
      }
    }
  }
</style>
